package com.caojing.haolemai.ui.homedetail;

import com.caojing.haolemai.bean.ContentBean;
import com.caojing.haolemai.httputils.HttpUtils;

import java.util.HashMap;

/**
 * Created by CaoJing on 2016/10/18.
 */
public class HomeDetailPresenter implements HomeDetailContract.presenter {
    private HomeDetailContract.Model model;
    private HomeDetailContract.View view;

    public HomeDetailPresenter(HomeDetailContract.View view) {
        this.view = view;
        this.model = new HomeDetailModel();
    }

    @Override
    public void initData(String path, HashMap<String, String> params) {
        model.getContentBean(path,params, new HttpUtils.HttpCallBack<ContentBean>() {
            @Override
            public void onSucess(ContentBean contentBean) {
                if (contentBean!=null){
                    view.onSuccessGetContentBean(contentBean);
                }
            }
            @Override
            public void onFail() {
                view.onFailGetContentBean("ContetnBean检查网络");
            }
        });
    }
}
